<?php
/**
 * Created by PhpStorm.
 * User: zhaoye
 * Date: 16/7/17
 * Time: 下午1:48
 */

namespace service;

//use model\TestModel;
use ZPHP\Core\App;
use ZPHP\Core\Db;
use ZPHP\Core\Log;
use ZPHP\Platform\Linux;

class Test{


    public function test($key){
        sleep(1);
        $dsn="mysql:dbname=test;host=127.0.0.1";
        $db_user='root';
        $db_pass='root';
        $pdo=new \PDO($dsn,$db_user,$db_pass);
        //新增
        $sql="insert into shop (name,number) values ('ff',123)";
        $res=$pdo->exec($sql);
        return 'ok';

    }

//    //修改
//$sql="update buyer set username='ff123' where id>3";
//$res=$pdo->exec($sql);
//echo '影响行数：'.$res;
////查询
//$sql="select * from buyer";
//$res=$pdo->query($sql);
//foreach($res as $row){
//echo $row['username'].'<br/>';
//}
////删除
//$sql="delete from buyer where id>5";
//$res=$pdo->exec($sql);
//echo '影响行数：'.$res;


//    public function cache($key){
//        Log::write($key);
////        return 'ssss';
////        yield App::model('Test')->test($key);
//        $model = new TestModel();
//        yield $model->test($key);
//    }
}